﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Core.DataAccess.Model.Migrations.ProjectInformation
{
    public partial class Informationinit : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "InformationAttribute",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    InfoKey = table.Column<int>(nullable: false),
                    TypeKey = table.Column<int>(nullable: false),
                    Content = table.Column<string>(nullable: true),
                    RegTime = table.Column<DateTime>(nullable: false),
                    EndTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InformationAttribute", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InformationHistory",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    UserKey = table.Column<int>(nullable: false),
                    TypeKey = table.Column<int>(nullable: false),
                    Content = table.Column<string>(nullable: true),
                    RegTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InformationHistory", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InformationList",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    UserKey = table.Column<int>(nullable: false),
                    ProjectToken = table.Column<string>(maxLength: 21, nullable: true),
                    TypeKey = table.Column<int>(nullable: false),
                    Title = table.Column<string>(maxLength: 50, nullable: true),
                    Content = table.Column<string>(nullable: true),
                    Related = table.Column<string>(maxLength: 2000, nullable: true),
                    Extend = table.Column<string>(maxLength: 2000, nullable: true),
                    RegTime = table.Column<DateTime>(nullable: false),
                    EndTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InformationList", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InformationType",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    InfoKey = table.Column<int>(nullable: false),
                    TypeKey = table.Column<int>(nullable: false),
                    Content = table.Column<string>(nullable: true),
                    RegTime = table.Column<DateTime>(nullable: false),
                    EndTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InformationType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InformationTypeAttribute",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    TypeKey = table.Column<int>(nullable: false),
                    Content = table.Column<string>(nullable: true),
                    RegTime = table.Column<DateTime>(nullable: false),
                    EndTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InformationTypeAttribute", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "InformationAttribute");

            migrationBuilder.DropTable(
                name: "InformationHistory");

            migrationBuilder.DropTable(
                name: "InformationList");

            migrationBuilder.DropTable(
                name: "InformationType");

            migrationBuilder.DropTable(
                name: "InformationTypeAttribute");
        }
    }
}
